/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.models.entities;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Administrator
 */
@Entity
@Table(name = "tblRoom", catalog = "cungonbaiDB", schema = "dbo")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "TblRoom.findAll", query = "SELECT t FROM TblRoom t"),
    @NamedQuery(name = "TblRoom.findByRoomId", query = "SELECT t FROM TblRoom t WHERE t.roomId = :roomId"),
    @NamedQuery(name = "TblRoom.findByCreateTime", query = "SELECT t FROM TblRoom t WHERE t.createTime = :createTime"),
    @NamedQuery(name = "TblRoom.findByType", query = "SELECT t FROM TblRoom t WHERE t.type = :type"),
    @NamedQuery(name = "TblRoom.findByStatus", query = "SELECT t FROM TblRoom t WHERE t.status = :status"),
    @NamedQuery(name = "TblRoom.findByCloseTime", query = "SELECT t FROM TblRoom t WHERE t.closeTime = :closeTime"),
    @NamedQuery(name = "TblRoom.findByRoomName", query = "SELECT t FROM TblRoom t WHERE t.roomName = :roomName")})
public class TblRoom implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "roomId", nullable = false)
    private Integer roomId;
    @Column(name = "createTime")
    @Temporal(TemporalType.TIMESTAMP)
    private Date createTime;
    @Column(name = "type")
    private Integer type;
    @Column(name = "status")
    private Integer status;
    @Column(name = "closeTime")
    @Temporal(TemporalType.TIMESTAMP)
    private Date closeTime;
    @Size(max = 100)
    @Column(name = "roomName", length = 100)
    private String roomName;
    @JoinColumn(name = "userId", referencedColumnName = "userId")
    @ManyToOne
    private TblUser userId;
    @JoinColumn(name = "topicId", referencedColumnName = "topicId")
    @ManyToOne
    private TblTopic topicId;
    @OneToMany(mappedBy = "roomId")
    private List<TblRoomUser> tblRoomUserList;

    public TblRoom() {
    }

    public TblRoom(Integer roomId) {
        this.roomId = roomId;
    }

    public Integer getRoomId() {
        return roomId;
    }

    public void setRoomId(Integer roomId) {
        this.roomId = roomId;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public Date getCloseTime() {
        return closeTime;
    }

    public void setCloseTime(Date closeTime) {
        this.closeTime = closeTime;
    }

    public String getRoomName() {
        return roomName;
    }

    public void setRoomName(String roomName) {
        this.roomName = roomName;
    }

    public TblUser getUserId() {
        return userId;
    }

    public void setUserId(TblUser userId) {
        this.userId = userId;
    }

    public TblTopic getTopicId() {
        return topicId;
    }

    public void setTopicId(TblTopic topicId) {
        this.topicId = topicId;
    }

    @XmlTransient
    public List<TblRoomUser> getTblRoomUserList() {
        return tblRoomUserList;
    }

    public void setTblRoomUserList(List<TblRoomUser> tblRoomUserList) {
        this.tblRoomUserList = tblRoomUserList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (roomId != null ? roomId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof TblRoom)) {
            return false;
        }
        TblRoom other = (TblRoom) object;
        if ((this.roomId == null && other.roomId != null) || (this.roomId != null && !this.roomId.equals(other.roomId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.models.entities.TblRoom[ roomId=" + roomId + " ]";
    }
    
}
